import { Component, OnInit } from '@angular/core';
import {Resume} from '../../../entity/resume';
import {TalentService} from '../../../service/talent.service';
import {ActivatedRoute} from '@angular/router';
import {Talent} from '../../../entity/talent';

@Component({
  selector: 'app-resume-details',
  templateUrl: './resume-details.component.html',
  styleUrls: ['./resume-details.component.css']
})
export class ResumeDetailsComponent implements OnInit {
  resume: any = new Resume();
  talent: any = new Talent();
  constructor(
    private route: ActivatedRoute,
    private talentService: TalentService
  ) {
    this.getResume();
  }

  ngOnInit() {
  }

  getResume() {
    const id = this.route.snapshot.paramMap.get('id');
    this.talentService.findPositonOne(Number.parseInt(id))
      .subscribe(resume => {
        this.resume = resume;
        this.talentService.findTalentInfo(this.resume.talentId)
          .subscribe(talent => this.talent = talent);
      });
  }

}
